package com.geek.controller;

import com.geek.bean.data.TopicData;
import com.geek.bean.data.TopicRelatedData;
import com.geek.bean.BaseRespVo;
import com.geek.service.TopicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("wx/topic")
    public class WxTopicController {

        @Autowired
        TopicService topicService;

        //首页点击专题精选进入列表查看
        @RequestMapping("list")
    public BaseRespVo list(Integer page,Integer limit){
        Map<String,Object> data = topicService.listData(page,limit);
        return BaseRespVo.ok(data);
    }
    
    //点击专题查看专题详情
    @RequestMapping("detail")
    public BaseRespVo detail(Integer id){
        TopicData data = topicService.detail(id);   
        return BaseRespVo.ok(data);
    }
    
    //专题详情中最后的专题推荐
    @RequestMapping("related")
    public BaseRespVo related(Integer id){
        TopicRelatedData data = topicService.related(id);
        return BaseRespVo.ok(data);
    }
}
